package com.mpsc.spring.demo.event;

import org.springframework.context.ApplicationEvent;

/**
 * 事件监听类
 */
public class SendMsgEvent extends ApplicationEvent {
    /**
     * Create a new ApplicationEvent.
     *
     * @param source the object on which the event initially occurred (never {@code null})
     */
    public SendMsgEvent(Object source) {
        super(source);
    }

    // 收件人
    public String receiver;

    // 收件内容
    public String content;

    public SendMsgEvent(Object source, String receiver, String content) {
        super(source);
        this.receiver = receiver;
        this.content = content;
    }

    public void output() {
        System.out.println("I had been sand a msg to " + this.receiver);
    }
}
